package com.qingcloud.fexecutor.base.enums;

public enum SoftwareFileTypeEnum {

    INSTALL(1, "安装包"),
    DEPLOY(2, "部署脚本"),
    EXE(3, "执行脚本"),
    CONFIG(4, "配置文件"),
    LOG(5, "日志文件");

    public final Integer code;
    public final String name;

    SoftwareFileTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (SoftwareFileTypeEnum type : SoftwareFileTypeEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static SoftwareFileTypeEnum findByName(String name) {
        for (SoftwareFileTypeEnum type : SoftwareFileTypeEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }
}
